package com.fa4j.system.login.convert;

import com.fa4j.common.base.convert.ConverterConfig;
import com.fa4j.system.account.model.AccountModifyCmd;
import com.fa4j.system.app.model.AppRole;
import com.fa4j.system.login.dto.LoginSessionDTO;
import com.fa4j.system.login.model.LoginInfo;
import com.fa4j.system.login.model.LoginModifyCmd;
import com.fa4j.system.login.model.LoginRoleInfo;
import com.fa4j.system.login.model.LoginSession;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(config = ConverterConfig.class)
public interface LoginConverter {

    @Mapping(target = ".", source = "account")
    @Mapping(target = "token", source = "accessToken")
    LoginInfo toLoginInfo(LoginSession session);

    LoginSessionDTO toSessionDTO(LoginSession loginSession);

    AccountModifyCmd toAccountModifyCmd(LoginModifyCmd cmd);

    LoginRoleInfo toRoleInfo(AppRole role);
}
